import java.util.StringTokenizer;

class P338_39643 {

    public static void main(String[] args) {
    	String line = readLn();
    	
    	while (!"0".equals(line)) {
    		StringTokenizer st = new StringTokenizer(line);
    		String x = st.nextToken();
    		String y = st.nextToken();
    		process(x, y);
    		line = readLn();
//    		if (!"0".equals(line))
    		System.out.println();
    	}
    }

    private static void process(String xSt, String ySt) {
    	
    	xSt = onlyZeros(xSt);
    	ySt = onlyZeros(ySt);
    	
    	if ("0".equals(xSt) || "0".equals(ySt)) { 
    		int greater = xSt.length() > ySt.length() ? xSt.length() : ySt.length();
    		String answer = xSt;
    		for (int k = xSt.length(); k < greater; k++) {
    			answer = " " + answer;
    		}
    		System.out.println(answer);
    		answer = ySt;
    		for (int k = ySt.length(); k < greater; k++) {
    			answer = " " + answer;
    		}
    		System.out.println(answer);
    		answer = "";
    		for (int k = 0; k < greater; k++) {
    			answer = answer + "-";
    		}
    		System.out.println(answer);
    		answer = "0";
    		for (int k = 1; k < greater; k++) {
    			answer = " " + answer;
    		}
    		System.out.println(answer);
    		return;
    		
    	}
    	
		int[][] matrix = new int[ySt.length() + 3][xSt.length() + ySt.length() + 2];
		
		int j = 0;
		for (int k = xSt.length() - 1; k >= 0; k--) {
			matrix[0][j++] = xSt.charAt(k) - '0';
		}

		j = 0;
		for (int k = ySt.length() - 1; k >= 0; k--) {
			matrix[1][j++] = ySt.charAt(k) - '0';
		}
		
		for (int k = 0; k < ySt.length(); k++) {
			for (int l = 0; l < xSt.length(); l++) {
				matrix[k+2][l+k] = matrix[1][k] * matrix[0][l];
			}
			
			int length = matrix[k + 2].length - 1;
			for (int l = 0; l < length; l++) {
				matrix[k+2][l+1] += matrix[k+2][l] / 10;
				matrix[k+2][l] = matrix[k+2][l] % 10;
			}
			
		}
		
		int kLength = matrix.length-1;
		for (int l = 0; l < matrix[0].length - 1; l++) {
			int value = 0;
			for (int k = 2; k < kLength; k++) {
				value += matrix[k][l];
			}
			matrix[kLength][l] = value ;
		}
		
		for (int l = 0; l < matrix[0].length-1; l++) {
			matrix[kLength][l+1] += matrix[kLength][l] / 10;
			matrix[kLength][l] = matrix[kLength][l] % 10;
		}

		
		printFormatted(matrix);
		
//		for (int k = 0; k < matrix.length; k++)
//			print(matrix[k]);
		
	}

	private static String onlyZeros(String st) {
		String x = st.trim();
		int length = x.length();
		
		for (int k = 0; k < length; k++) {
			if (x.charAt(k) != '0') return st;
		}
		return "0";
	}

	private static void printFormatted(int[][] matrix) {
		char[][] m = new char[matrix.length+2][matrix[0].length];
				
		int greater = 0;
		
		for (int k = 0; k < 2; k++) {
			boolean foundNotZero = false;
			
			for (int j = matrix[0].length - 1; j >= 0 ; j--) {
				if (!foundNotZero) {
					if (matrix[k][j] != 0) {
						foundNotZero = true;
						if (j > greater) {
							greater = j;
						}
					}
				}
				m[k][j] = (matrix[k][j] != 0 ? (char)('0' + matrix[k][j]) : foundNotZero ? '0' :  ' '); 
			}
			
			if (m[k][0] == ' ') m[k][0] = '0';  
			
		}
		
		for (int k = 0; k < m[2].length; k++) {
			if (k <= greater)
				m[2][k] = '-';
			else m[2][k] = ' ';
		}
		
		for (int k = 2; k < matrix.length; k++) {
			boolean foundNotZero = false;
			
			int until = k - 2 >= 0 ? k - 2 : 0; 
			
			for (int j = matrix[0].length - 1; j >= until ; j--) {
				if (!foundNotZero) {
					if (matrix[k][j] != 0) {
						foundNotZero = true;
						if (j > greater) {
							greater = j;
						}
					}
				}
				m[k+1][j] = (matrix[k][j] != 0 ? (char)('0' + matrix[k][j]) : foundNotZero ? '0' :  ' '); 
			}
			
			if (m[k+1][0] == ' ') m[k+1][0] = '0';  
			
		}
		

		boolean foundNotZero = false;
		for (int j =  matrix[0].length - 1; j >= 0; j--) {
			if (!foundNotZero) {
				if (matrix[matrix.length-1][j] != 0) {
					foundNotZero = true;
					if (j > greater) {
						greater = j;
					}
				}
			}
			m[m.length-2][j] = '-';
			m[m.length-1][j] = (matrix[matrix.length-1][j] != 0 ? (char)('0' + matrix[matrix.length-1][j]) : foundNotZero ? '0' :  ' ');
		}
		if (m[m.length-1][0] == ' ') m[matrix.length][0] = '0';
		
		for (int k = 0; k < 3; k++)
			print(m[k], greater);
		
		if (matrix.length - 3 > 1) {
			
			StringBuffer sb = new StringBuffer();
			int counter = 0;
			for (int k = 3; k < m.length - 2; k++)
				if (print(m[k], greater, sb)) counter++;
			
			if (counter > 1) {
//				print(m[2], greater);
				System.out.print(sb.toString());
				print(m[m.length-2], greater);
			}
		}
		
		print(m[m.length-1], greater);
		
//			print(m[k], m[0].length-1);
		
		
	}

	private static boolean print(char[] m, int greater, StringBuffer sb) {
		String x = "";
		boolean found = false;
		for (int k  = 0; k <= greater; k++) {
			if (m[k] != ' ') {
//				System.out.println(".");
				found = true;
			} else {
//				System.out.println("-");
			}
			
			if (found) {
//				if (m[k] == ' ') m[k]= '.';
				
				x = m[k] + x;
			}
//			System.out.println(m[k]);
		}
		
		if (!"".equals(x.trim()) && !"0".equals(x.trim())) {
			int index = x.indexOf(0);
			if (index > -1)
				sb.append(x.substring(0, index) + "\n");
			else {
				sb.append(x + "\n");
			}
			return true;
		}
		
		return false;
					
	}

	
	private static void print(char[] m, int greater) {
		String x = "";
		boolean found = false;
		for (int k  = 0; k <= greater; k++) {
			if (m[k] != ' ') {
//				System.out.println(".");
				found = true;
			} else {
//				System.out.println("-");
			}
			
			if (found) {
//				if (m[k] == ' ') m[k]= '.';
				
				x = m[k] + x;
			}
//			System.out.println(m[k]);
		}
		
		if (!"".equals(x.trim()) && !"0".equals(x.trim())) {
			int index = x.indexOf(0);
			if (index > -1)
				System.out.println(x.substring(0, index));
			else {
				System.out.println(x);
			}
		}
	}

	private static void print(int[] is) {
		String x = "";
		for (int k  = 0; k < is.length; k++) {
			x = is[k] + x;
		}
		
		System.out.println(x);
		
	}


	static String readLn() {
        String newLine = System.getProperty("line.separator");
        StringBuffer buffer = new StringBuffer();
        int car = -1;
        try {
            car = System.in.read();
            while ((car > 0) && (car != newLine.charAt(0))) {
                buffer.append((char)car);
                car = System.in.read();
            }
            if (car == newLine.charAt(0))
            System.in.skip(newLine.length() - 1);
        } catch (java.io.IOException e) { return (null);}
        if ((car < 0) && (buffer.length() == 0)) return (null);
        return (buffer.toString()).trim();
    }

}